﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace SurehealthForms.Manager
{
    public partial class ItemSales : Form
    {
        public ItemSales()
        {          
            InitializeComponent();
        }

        List<string> _items = new List<string>();
        private void ItemSales_Load(object sender, EventArgs e)
        {
            foreach (object o in DodgyBobStockControl.Stock.StockList())
            {
                StockList.Items.Add(o);

                StreamReader reader = new StreamReader(@"Items\\" + o + ".txt");
                _items.Add(reader.ReadLine());
                reader.Close();
            }
            listBox1.DataSource = _items;
            listBox1.Update();

        }

        private void button1_Click(object sender, EventArgs e)
        {
            foreach (object o in DodgyBobStockControl.Stock.StockList())
            {
                StreamWriter writer =new StreamWriter(@"Items\\" + o + ".txt");
                writer.WriteLine("0");
                writer.Close();
            }
        }
    }
}
